//===============================================================================
// Q4Tech Engineering Team
// Mobile Updater Application Block - November 2006
//===============================================================================
// Copyright  Q4Tech Informatica Argentina.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;


namespace Microsoft.ApplicationBlocks.Mobile.Updater.ActivationProcessors
{
	public class RunningApplicationsManager
	{
		const string subKeyName = @"MobileUpdater";

		#region Singleton 
		static private RunningApplicationsManager instance;

		private RunningApplicationsManager()
		{
		}

		public static RunningApplicationsManager Instance
		{
			get
			{
				if (instance == null)
					instance = new RunningApplicationsManager();
				return instance;
			}
		}

		#endregion

        // TODO: Make this work?
#if false
        public bool SendCloseMessage(string processPath)
        {
            RegistryKey key = Registry.LocalMachine.OpenSubKey(subKeyName);
            string handle = (string)key.GetValue(processPath);
            IntPtr hWnd = (IntPtr)Convert.ToInt64(handle);

            Message msg = Message.Create(hWnd,
                                            (int)RegisterMessages.CloseApplication,
                                            IntPtr.Zero,
                                            IntPtr.Zero);
            MessageWindow.SendMessage(ref msg);

            return (msg.WParam != IntPtr.Zero);
        }
#endif
	}
}
